package com.hpin.mlxteacher.adapter;

import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.hpin.mlxteacher.R;

import java.util.List;

/**
 * Created by Aaron on 15/8/10.
 */
public class BabyPagerAdapter extends PagerAdapter {

    private List<View> viewList;

    public BabyPagerAdapter(List<View> viewList) {
        this.viewList = viewList;
    }

    @Override
    public int getCount() {
        return 30;
    }

    @Override
    public boolean isViewFromObject(View view, Object object) {
        return view==object;
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
//        super.destroyItem(container, position, object);
        container.removeView(viewList.get(position));


    }

    @Override
    public Object instantiateItem(ViewGroup container, int position) {

        container.addView(viewList.get(position));

//        LogUtil.e("TAG","viewpager ==== position===::" + position);


        View v = viewList.get(position);

       TextView tv_title_name = (TextView) v.findViewById(R.id.tv_title_name);

//        switch (position) {
//
//            case  0:
//
//                tv_title_name.setText("李大龙");
//                break;
//            case  1:
//                tv_title_name.setText("大大龙");
//                break;
//            case  2:
//                tv_title_name.setText("小大龙");
//                break;
//
//
//        }


        return viewList.get(position);
    }
}
